<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>angularJS- 76课 uiRouter路由模板设置方式实例</title>
    <script type="text/javascript" src="../js/angular.js"></script>
    <script type="text/javascript" src='../js/angular-ui-router.min.js'></script>
    <script type="text/javascript" src='../js/jquery.min.js'></script>
</head>
<body ng-app='app'>
    <div ng-controller='ctrl'>
        <a href="" ui-sref='index'>首页</a>
        <a href="" ui-sref='lists'>列表页</a>
        <div ui-view></div>
    </div>
</body>
    <script>
        var app = angular.module('app',['ui.router']);
        app.config(['$stateProvider','$urlRouterProvider',function($stateProvider,$urlRouterProvider){
            $urlRouterProvider.otherwise('');
            $stateProvider.state('home',{
                url:'',         //为空表示默认进入的是该路由
                template:'<h1>网易云课堂</h1>'
            }).state('index',{
                url:'/index',
                templateUrl:'../views/76-index.html'        //引入外部模板
            }).state('lists',{
                url:'/lists',
                template:'<h2>列表页</h2>'
            })
        }]);
        app.controller('ctrl',['$scope',function($scope){

        }]);

    </script>
</html>